
#ifndef _LED_H_
#define _LED_H_

#include "config.h"

//#define LED_R1_PORT (PortB)
//#define LED_R1_PIN (Pin10)
//#define LED_R2_PORT (PortB)
//#define LED_R2_PIN (Pin02)
//#define LED_G1_PORT (PortA)
//#define LED_G1_PIN (Pin04)
//#define LED_G2_PORT (PortA)
//#define LED_G2_PIN (Pin05)

//#define LED_R1_PORT (PortB)
//#define LED_R1_PIN (Pin02)
//#define LED_R2_PORT (PortB)
//#define LED_R2_PIN (Pin10)

//#define LED_G1_PORT (PortB)
//#define LED_G1_PIN (Pin00)
//#define LED_G2_PORT (PortA)
//#define LED_G2_PIN (Pin10)

#define LED_G1_PORT (PortB)
#define LED_G1_PIN (Pin02)
#define LED_G2_PORT (PortB)
#define LED_G2_PIN (Pin10)

#define LED_R1_PORT (PortB)
#define LED_R1_PIN (Pin00)
#define LED_R2_PORT (PortA)
#define LED_R2_PIN (Pin10)




/*
#define A(x) T_##x
#define B（x) #@x
#define C（x) #x
我们假设：x=1，则有：
A(1)------〉T_1
B(1)------〉'1'
C(1)------〉"1"
*/
#define LED_CONNECT_PIN(NUM, COLOR) LED##_##COLOR##NUM##_PIN
#define LED_CONNECT_PORT(NUM, COLOR) LED##_##COLOR##NUM##_PORT
//低电平亮，高电平灭
#define LED_ON(NUM, COLOR)	PORT_ResetBits(LED_CONNECT_PORT(NUM, COLOR), LED_CONNECT_PIN(NUM, COLOR))
#define LED_OFF(NUM, COLOR)	PORT_SetBits(LED_CONNECT_PORT(NUM, COLOR), LED_CONNECT_PIN(NUM, COLOR))

void ledInit(void);

#endif
